package igou.togogo.controller;

import igou.togogo.service.IpictureService;
import igou.togogo.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

@Controller
public class PictureController {

    @Autowired
    IpictureService ipictureService;

    @RequestMapping("/pic/upload")
    @ResponseBody
    public String uploadPicture(MultipartFile uploadFile){
        Map result = ipictureService.uploadPicture(uploadFile);
        String json = JsonUtils.objectToJson(result);
        return json;

    }
}
